package cn.gztang.entity.dto;

import cn.gztang.util.JsoupUtil;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

/**
 * @author GaoFeng2017
 * @date 2018/9/9 18:55
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class UserInfoAdd {

    @Length(min = 2, max = 20)
    @NotBlank
    private String username;

    @Range(min = 2, max = 10)
    @NotNull
    private Byte type;

    @Length(min = 5, max = 20)
    @NotBlank
    private String account;

    @Length(min = 8, max = 20)
    @NotBlank
    private String password;

    @NotBlank
    private String phone;

    public String getUsername() {
        return JsoupUtil.getSafeHtml(username);
    }

    public String getAccount() {
        return JsoupUtil.getSafeHtml(account);
    }

    public String getPassword() {
        return JsoupUtil.getSafeHtml(password);
    }

    public String getPhone() {
        return JsoupUtil.getSafeHtml(phone);
    }
}
